﻿using StudentManagement.Infrastructure.Repositories;
using StudentManagement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace StudentManagement.Services
{
    public class UserService : IUserService
    {
        private readonly IRepository<User> repo;

        public UserService(IRepository<User> userRepository)
        {
            this.repo = userRepository;
        }

        public User FindUser(string userName, string userPwd)
        {
            return repo.GetAll().FirstOrDefault(u => 
                u.UserName.Equals(userName) && u.UserPwd.Equals(userPwd));
        }
    }
}
